<?php
class CSingleton {
	static private $objects = array();
	
	static public function get( $className, $args = null ) 
	{
		// Check $className
		if(!is_string($className)) throw new Exception("No valid class name.");
		
		if(!isset(CSingleton::$objects[$className]))
		{
			CSingleton::$objects[$className] = &CFactory::get($className, $args);
		}
		
		return CSingleton::$objects[$className];
	}
}
?>